/**************************************************************************
 * @doc CORE
 * @module scalls.H |  
 * Header file for the Source code that displays the configuration tables in setup
 * array.
 *
 * Product     :   SoftPay 2000 (Global Payment Methodology).
 * <nl>Developer   :   
 * <nl>Notes       :
 *
 * @head3 Core Functions |
 * @index | Core
 * @end
 *
 * Copyright (c) 1996-2000 by VeriFone Inc. All rights reserved.
 * 
 * No part of this software may be used, stored, compiled, reproduced,
 * modified, transcribed, translated, transmitted, or transferred, in any form 
 * or by any means whether electronic, mechanical, magnetic, optical, 
 * or otherwise, without the express prior written permission of VeriFone, Inc.
 *
 * Revision History
 * ------------------------------------------------------------------------
 $log:  $
 * ------------------------------------------------------------------------
 ********************************************************************************/

#ifndef VSSCALLS_H
#define VSSCALLS_H

#include <define.h>

#define NO_VALIDATION  0x5000 /* No validation procedure */

#define FLD_NULL  0x00  /* To signify "End of Table" */
#define FLD_CHAR  0x01  /* Stores single key press value */
#define FLD_SHORT 0x02  /* only INPUT_NUMS IO Type is appropriate */
#define FLD_INT   0x04  /* only INPUT_NUMS IO Type is appropriate */
#define FLD_LONG  0x08  /* only INPUT_NUMS IO Type is appropriate */
                         /* support for float is questionable */
#define FLD_DBL   0x0A  /* only INPUT_NUMS IO Type is appropriate */
#define FLD_BIT   0x0B  /* Bit fields(0 or 1) only INPUT_FLAG IO Type is appropriate */
#define FLD_STR   0x0C  /* NULL_CH terminated string */
#define FLD_BYTE  0x0D  /* only INPUT_NUMS IO Type is appropriate */
#define FLD_SHARR 0x0E  /* short array */
#define MSB_MASK  0x0D  /* Mask all bits other than MSB (1000 0000) */

#define CONFIG_NM_SIZE      8   /* E.g., CDT99 */
#define CFG_FNAME_SZ        3

#define INPUT_NUMS          0   /* Input numeric keys only */
#define INPUT_ALNUMS        1   /* Input alphanumeric keys */
#define INPUT_HIDE_NUMS     2   /* Input numeric keys with asterisk echo */
#define INPUT_HIDE_ALNUMS   3   /* Input alnumeric keys with asterisk echo */
#define INPUT_FLAG          4   /* Input 1 or 0 */

#define BIT_SIZE            1
#define CHAR_SIZE           1
#define BYTE_SIZE           1
#ifdef __arm
#define INT_SIZE            4
#endif
#ifdef _TARG_68000
#define INT_SIZE            2
#endif
#define LONG_SIZE           4
#define SHORT_SIZE          2

#define FIELD_NAME_SIZE     15

/*
 *      Maximum values to fit in Field types
 */
#define MAX_INT     0x7fff
#define MAX_BYTE    0xff
#define MAX_LONG    0x7fffffff
#define MAX_BUFFER_SIZE    100

#ifdef T390
#define REC_UP      FUNC_KEY_1
#define REC_DN      FUNC_KEY_2
#define REC_EDIT    FUNC_KEY_3
#define REC_ABRT    FUNC_KEY_4
#else
#define REC_UP      LEFT_SCROLL_KEY
#define REC_DN      RIGHT_SCROLL_KEY
#define REC_EDIT    ENTER_KEY
#define REC_ABRT    CLEAR_KEY
#endif

#define MAX_CE_FIELDS   20        /* Only 20 fields per rec possible */
#define FLAG_STR_SIZE   1

// Table Editing List Entry Structure Definition

typedef struct {
	char	szText[MESSAGE_SIZE + 1];
	short	shValue;
} ListEntry;
/*
 * Attributes of each of the fields in the data structures.
 * inFldType   = Type of the field to be extracted.
 * chFldLen    = Maximum length of the field.
 * These field attributes are required in order to know the type and
 * maximum length of the field to be extracted.
 */

typedef struct
{
   short inFieldName;                    /* Offset to Name of field in a file */
   unsigned char ucFieldType;       	 /* Field Type: (INT, STR, etc.) */
   char szFieldLabel[CONFIG_NM_SIZE + 1];/* Field Label for Express Config */
   short    shFieldFuncID;        	 		 /* Function Index */
   short inFieldSize;                    /* Field's size */
   int    f1                  : 1;    /* padded bits */
   int   f2                  : 1;    /* padded bits */
   int   f3                  : 1;    /* padded bits */
   int   f4                  : 1;    /* padded bits */
   int   f5                  : 1;    /* padded bits */
   int   f6                  : 1;    /* padded bits */
   int   f7                  : 1;    /* padded bits */
   int   f8                  : 1;    /* padded bits */
   int   f9                  : 1;    /* padded bits */
   int   fFieldEditOpenBatch : 1;    /* Edit if batch is open */
   int   fFieldShow          : 1;    /* Display field value */
   int   fFieldEditable      : 1;    /* Allow changes */
   int   fFieldTitle         : 1;    /* Main textual distinguisher */
   int   fFieldZonTalks      : 1;    /* Can be changed via Zontalk */
   int   fFieldPrint         : 1;    /* Appears in Setup Report */
   int   fAltEntry   		   : 1;    /* Alternate Entry Field */
#ifdef __arm    
    int f10                  : 1;    /* padded bits */
    int f11                  : 1;    /* padded bits */
    int f12                  : 1;    /* padded bits */
    int f13                  : 1;    /* padded bits */
    int f14                  : 1;    /* padded bits */
    int f15                  : 1;    /* padded bits */
    int f16                  : 1;    /* padded bits */
    int f17                  : 1;    /* padded bits */
    int f18                  : 1;    /* padded bits */
    int f19                  : 1;    /* padded bits */
    int f20                  : 1;    /* padded bits */
    int f21                  : 1;    /* padded bits */
    int f22                  : 1;    /* padded bits */
    int f23                  : 1;    /* padded bits */
    int f24                  : 1;    /* padded bits */
    int f25                  : 1;    /* padded bits */
#endif 
   char     chFieldIOFmt;                      /* Format spec for I/O */
   short    inFieldFullSize;                   /* Size of the field's container */
   short    inFieldPos;                        /* Offset of field relative to record start */
   short    inFieldBitNum;                     /* Offset of bit field relative to int start */
} FieldDefinition;


/* Instead of including all the entries in the batch record   */
/* and batch key a small structure including selected members */
/* is declared and used, LOC_BAT_REC is Local Batch Record    */

typedef struct TagLocBat
{
    char szTranType[MESSAGE_SIZE + 1];  /* transaction message instead of number */
    char szPAN[PAN_SIZE + 1];
    char szTotalOfTransactionAmount[AMT_SIZE + 1 + 1];    /* A '.' can also be included */
    char szInvNum[INV_NUM_SIZE + 1];
    char szAuthCode[AUTH_CODE_SIZE + 1];
} LOC_BAT_REC;

#define SIZE_LOC_BAT_REC       sizeof(LOC_BAT_REC)


#endif

